/**
 * @Author your name
 * @Date 2021-03-05 13:57:23
 * @LastEditTime 2021-03-05 14:30:51
 * @LastEditors Please set LastEditors
 * @Description In User Settings Edit 
 * @FilePath \fed-e-task-04-06\code\angular-demo\src\app\store\selectors\todo.selectors.ts
 */
import { createFeatureSelector, createSelector } from '@ngrx/store';
import { AppState } from '..';
import { adapter, State, todoFeatureKey } from '../reducers/todo.reducer';
// selectTotal 获取数据条数
// selectAll 获取所有数据 以数组形式呈现
// selectEntities 获取实体集合 以字典形式呈现
// selectIds 获取id集合, 以数组形式呈现
const { selectIds, selectEntities, selectAll, selectTotal } = adapter.getSelectors();

export const selectTodo = createFeatureSelector<AppState, State>(todoFeatureKey)

export const selectTodos = createSelector(selectTodo, selectAll)